package com.zwj.batch.config.springBatch.incrementer;

import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.JobParametersIncrementer;

import javax.annotation.Resource;
import java.util.Date;

/**
 * 自定义时间戳增量器
 *
 * @author 张文接
 * @version 1.0
 * @createTime 2023-05-22 21:30:00
 */
public class DailyTimestampParamIncrementer implements JobParametersIncrementer {
    @Resource
    private JobParametersBuilder jobParametersBuilder;

    @Override
    public JobParameters getNext(JobParameters jobParameters) {
        return jobParametersBuilder
                .addLong("daily", new Date().getTime())
                .toJobParameters();
    }
}
